Philip Withnall [Wed, 21 Jun 2017 11:53:48 +0000 (12:53 +0100)]
lib/sym: Fix symbol versions for 2017.7 experimental symbols
There was a typo in the group name. It should be OK to change the
version since this is all hidden behind the --enable-experimental-api
configure option.
Signed-off-by: Philip Withnall <withnall@endlessm.com>
Closes: #950
Approved by: cgwalters
Philip Withnall [Wed, 21 Jun 2017 11:37:12 +0000 (12:37 +0100)]
lib/core: Fix ‘Since’ line for ostree_validate_remote_name()
This was missed when cherry-picking it out of
https://github.com/ostreedev/ostree/pull/924#discussion_r123097919.
Signed-off-by: Philip Withnall <withnall@endlessm.com>
Closes: #950
Approved by: cgwalters
Colin Walters [Tue, 20 Jun 2017 21:19:01 +0000 (17:19 -0400)]
ci: Enable -Werror=maybe-uninitialized
We don't want to inject this warning by default for every build
like the other ones in `configure.ac`, since it can be spruriously
wrong. But there's no reason not to have a more extended set of
warnings for well-known toolchains (e.g. f25).
Closes: #943
Approved by: jlebon
Colin Walters [Mon, 19 Jun 2017 14:54:05 +0000 (10:54 -0400)]
repo: Squash a gcc `-Wmaybe-uninitialized` warning
It's spurious, but unfortunately GCC doesn't currently understand that it will
always be set.
Closes: #943
Approved by: jlebon
Philip Withnall [Wed, 14 Jun 2017 11:28:52 +0000 (12:28 +0100)]
lib/core: Add ostree_validate_remote_name() for remote names
There are a few places in the code where ad-hoc validation was being
performed. Might as well formalise it a bit more.
Signed-off-by: Philip Withnall <withnall@endlessm.com>
Closes: #948
Approved by: cgwalters
Philip Withnall [Tue, 20 Jun 2017 16:38:15 +0000 (17:38 +0100)]
build: Add ‘devel’ or ‘release’ to OSTREE_FEATURES for test-symbols.sh
test-symbols.sh was looking for the DevelBuild string, which is actually
part of the output from `ostree --version`, not $OSTREE_FEATURES.
Signed-off-by: Philip Withnall <withnall@endlessm.com>
Closes: #948
Approved by: cgwalters
Jonathan Lebon [Mon, 19 Jun 2017 15:25:25 +0000 (11:25 -0400)]
ci: add ci-release-build.sh
Add a check that verifies that `is_release_build` is `yes` only for
release commits. And also verify that the commit message has the correct
version.
Closes: #945
Approved by: cgwalters
Colin Walters [Mon, 19 Jun 2017 14:37:19 +0000 (10:37 -0400)]
build-sys: Post-release version bump
Closes: #944
Approved by: jlebon
Colin Walters [Mon, 19 Jun 2017 15:23:45 +0000 (11:23 -0400)]
main: DevelBuild=yes to `ostree --version` for devel builds
And use it in `test-symbols.sh`, to fix the `distcheck` case;
the previous change stopped distributing `libostree-devel.sym`
in release builds.
Closes: #944
Approved by: jlebon
Colin Walters [Mon, 19 Jun 2017 14:34:35 +0000 (10:34 -0400)]
Release 2017.7
Closes: #942
Approved by: jlebon
Colin Walters [Mon, 19 Jun 2017 14:23:21 +0000 (10:23 -0400)]
build-sys: Add "release build" flag, use for symbol versioning
I was trying to do a release and move the symbols from `-devel.sym` into
`-release.sym`, but it turns out that at least GNU binutils `ld` treats an empty
version script as a syntax error. Fix this by adding a "release build"
flag, and only include `-devel` in non-release builds.
This would also make it easier to inject that flag into our `.pc` and
`ostree-version.h` and `ostree --version` metadata, but I didn't do that yet.
EDIT: Turns out a simpler fix is just to add an empty section. However I kept
this commit since it's a useful sanity check for whether we should include
`-devel.sym` in builds, and we may want to inject the metadata later.
Closes: #942
Approved by: jlebon
David Shea [Sat, 17 Jun 2017 16:08:41 +0000 (12:08 -0400)]
lib/repo: Fix annotations for out parameters
Change the annotation of the out parameters on ostree_repo_load_file
from `(allow-none)` to `(optional) (nullable)`. `allow-none` is
ambiguous, since these parameters can be both NULL on input and set to
NULL on return.
Closes: #939
Approved by: cgwalters
Alexander Larsson [Mon, 19 Jun 2017 09:06:30 +0000 (11:06 +0200)]
static delta apply: Work on bare-user-only repos
Flatpak make check is failing when applying a static delta
to a bare-user-only repo due to an assert. The fix is to add
bare-user-only to the assert check.
Closes: #940
Approved by: giuseppe
Colin Walters [Fri, 16 Jun 2017 15:26:43 +0000 (11:26 -0400)]
tests: Fix previous commit for selinux testing
I only checked the test passed, I didn't read the output closely, and
made it succeed without testing anything.
Fix the absolute/relative `/etc` references.
Closes: #937
Approved by: jlebon
Alexander Larsson [Fri, 16 Jun 2017 08:07:44 +0000 (10:07 +0200)]
pull: When mirroring, only replace summary if we're doing a full mirror
We're hitting this in flathub, where we have a bunch of local builds,
but we also mirror a few refs from the gnome runtime repo into it.
Its fixable by re-doing the summary, but for a short time the
wrong version is visible.
Fixes https://github.com/ostreedev/ostree/issues/846
Closes: #935
Approved by: cgwalters
Colin Walters [Fri, 16 Jun 2017 14:36:28 +0000 (10:36 -0400)]
checkout: Fix SELinux policy labeling when recursing
The code here tried to truncate the string to the previous length,
but that doesn't work when recursing, since further calls change the
length.
What actually ended up happening was the string would get corrupted
after the first level of recursion.
Closes: #936
Approved by: jlebon
Colin Walters [Thu, 15 Jun 2017 01:44:04 +0000 (21:44 -0400)]
lib: Split symbol versioning into -released and -devel
So far a lot of submitted PR have added symbols into the first
section. Split the file into `-released` and `-devel` to make
this more obvious.
To further enforce things, we hardcode a checksum of the `-released`
file in `test-symbols.sh`. Only release commits should update that
checksum.
Did you notice I like checksums?
Closes: #931
Approved by: pwithnall
Tristan Van Berkom [Thu, 15 Jun 2017 09:00:27 +0000 (18:00 +0900)]
ostreee-version.h.in: Added Since: version annotations
This is especially interesting for the versioning symbols themselves,
as it is an indicator of when applications using introspection information
can start to use a symbol in the library to check if they have a
recent enough version of OSTree to use.
Closes: #932
Approved by: cgwalters
Colin Walters [Wed, 14 Jun 2017 21:55:11 +0000 (17:55 -0400)]
lib/pull: Extend BAREUSERONLY_FILES flag to HTTP requests
For the flatpak PR: https://github.com/flatpak/flatpak/pull/849
It's really more convenient if this works for HTTP pulls as well, since flatpak
does various types of pulling, and we can just set the flag everywhere.
Further, we might as well reject the content as early as possible.
Closes: #930
Approved by: alexlarsson
Colin Walters [Wed, 14 Jun 2017 15:31:52 +0000 (11:31 -0400)]
lib/sysroot: Add some g_prefix_error() for ostree_sysroot_cleanup()
We saw this fail in a CI run. We've been trying to add strategic error prefixing
as a general rule, and this specific instance may help debug.
Closes: #929
Approved by: pwithnall
Colin Walters [Tue, 13 Jun 2017 18:52:46 +0000 (14:52 -0400)]
build-sys: post-release version bump
Per request by flatpak.
Closes: #928
Approved by: alexlarsson
Anton Gerasimov [Thu, 1 Jun 2017 10:43:50 +0000 (12:43 +0200)]
lib/sysroot: Add API to get pending/rollback for given stateroot
This imports a function that is used in rpm-ostree, and it's also intended for
use by https://github.com/advancedtelematic/aktualizr to display
what deployment we're going to boot next after the reboot.
Updated-by: Colin Walters <walters@verbum.org>
Closes: #897
Approved by: OYTIS
Colin Walters [Tue, 13 Jun 2017 17:26:33 +0000 (13:26 -0400)]
lib/checkout: Add bareuseronly_dirs option
This is a continuation of https://github.com/ostreedev/ostree/pull/926
for directories instead of files.
See: https://github.com/flatpak/flatpak/issues/845
This option suppresses mode bits outside of `0775` for directory
checkouts. I think most people should start doing this by default,
and use explicit overrides for e.g. `/tmp` if doing a recommit based
on a checkout.
Closes: #927
Approved by: alexlarsson
Colin Walters [Mon, 12 Jun 2017 19:06:19 +0000 (15:06 -0400)]
lib/pull: Add OSTREE_REPO_PULL_FLAGS_BAREUSERONLY_FILES
This is an option which is intended mostly for flatpak;
see: https://github.com/flatpak/flatpak/issues/845
We're adding an option for pulling into *all*
repo modes that has an effect similar to the `bare-user-only`
change from https://github.com/ostreedev/ostree/pull/909
This way one can pull content into e.g. a root-owned `bare` repository and
ensure that there aren't any setuid or world-writable files.
Closes: #926
Approved by: alexlarsson
Colin Walters [Mon, 12 Jun 2017 17:59:33 +0000 (13:59 -0400)]
lib/repo: Support hardlink conversions from bare-user to bu-only
Thinking about the problem of flatpak converting from `bare-user` to `bare-user-only`
"in place" by creating a new repo and doing a `pull-local`, I realized
that we can optimize this process by doing hardlinks for both metadata
and regular files. The repo formats are *almost* compatible, the
exception being symlinks.
An earlier patch caused us to do hardlinks for metadata, this patch takes things
to the next step and special cases this specific conversion. In this case we
need to parse the source object to determine whether or not it's a symlink.
Closes: #922
Approved by: alexlarsson
Colin Walters [Mon, 12 Jun 2017 17:38:52 +0000 (13:38 -0400)]
lib/repo: Import metadata via hardlink even for distinct repo modes
Our previous logic for import-via-hardlink only tried if the repo modes match,
but we *can* hardlink metadata between e.g. `archive` and `bare-user` repos, and
that's quite useful thing to do. Our documentation encourages converting to/from
those repo modes locally for build systems.
Closes: #922
Approved by: alexlarsson
Colin Walters [Mon, 12 Jun 2017 17:20:42 +0000 (13:20 -0400)]
lib/repo: Skip import via hardlink if repo owners don't match
Before this, if one had repos of matching mode but different owners,
which could happen if one e.g. makes a `bare` non-root repo in
`/ostree/deploy/$stateroot/var/tmp`, every time we tried to call `linkat()`
we'd get `EPERM` and fall back to a copy.
Fix this by saving the repo owner uid, and avoid trying to call `linkat()` if we
know it's going to fail. Of course most commonly in this scenario we'll
immediately fail trying to `chown` the files to `0`, but this is prep for a
future patch to improve `bare-user` → `bare-user-only` imports where we'll be a
bit more sophisticated.
Closes: #922
Approved by: alexlarsson
Philip Withnall [Wed, 7 Jun 2017 13:29:55 +0000 (14:29 +0100)]
lib/pull: Fix construction of a refspec to use the correct separator
This code looks like it was supposed to build a refspec, but it used a
slash as a separator rather than a colon. The following code does
recover by supporting prefix matching with slashes, but it seems like
this was perhaps not the intention.
Signed-off-by: Philip Withnall <withnall@endlessm.com>
Closes: #912
Approved by: cgwalters
Alexander Larsson [Thu, 8 Jun 2017 07:43:23 +0000 (09:43 +0200)]
lib/repo: Always look in staging directory for objects
Its often the case that we want to look at objects inside a commit,
before the objects the transaction is finished. For instance:
https://github.com/flatpak/flatpak/pull/837
Which tries to verify the file permissions before committing the
transaction.
And:
https://github.com/flatpak/flatpak/commit/
1e5ffa926a25acb655af7889b679b140bf44870b
Which collects the storage size of the objects so that we can
put the total download size in the commit metadata.
I tried to find all the places where we did reads from the
object directories, and in particular this fixes:
- `ostree_repo_load_file()` for `bare` repos (`archive` was already working).
- `ostree_repo_query_object_storage_size()`
- Applying deltas that reference not-yet-commited objects
Closes: #916
Approved by: cgwalters
Colin Walters [Mon, 12 Jun 2017 19:36:16 +0000 (15:36 -0400)]
lib/repo: Refactor object copy import function
This came up in: https://github.com/ostreedev/ostree/pull/881
Basically doing streaming for metadata is dumb. Split up the metadata/content
paths so we pass metadata around as `GVariant`. This drops the last internal
caller of `ostree_repo_write_metadata_stream_trusted()` which was the dumb
function mentioned.
Closes: #923
Approved by: jlebon
Colin Walters [Wed, 7 Jun 2017 18:21:59 +0000 (14:21 -0400)]
lib/checkout: Ignore world-writable dirs for bare-user-only checkout
See https://github.com/ostreedev/ostree/pull/909 for more information on the
rationale. Basically there's no reason for flatpak (which uses `bare-user-only`)
to have world-writable dirs. Particularly with the presence of the system
helper.
An approach I considered instead was to parse and validate directory metadata
objects at commit time. We still may do that in addition; for file objects we *had*
to do it that way because the actual files would be laid down suid. But directories
live only as inert `.dirmeta` objects until we do a checkout (i.e. `mkdir()`), so
we can solve the problem at checkout time.
Closes: #914
Approved by: alexlarsson
Colin Walters [Wed, 7 Jun 2017 17:56:47 +0000 (13:56 -0400)]
lib/commit: Drop some conditionals/clarify code in content path
Both callers of `commit_loose_object_trusted()` were passing
`OSTREE_OBJECT_TYPE_FILE`, so drop that parameter. This in turn
allows us to drop lots of checking of that inside the function.
Add a doc comment, and rename to `commit_loose_content_object()` for clarity.
Closes: #914
Approved by: alexlarsson
Colin Walters [Wed, 7 Jun 2017 17:42:15 +0000 (13:42 -0400)]
lib/commit: Port final object writing function to new code style
I noticed my previous patches incorrectly started doing `return glnx_throw*`
inside a `goto out;` function. Fix this by porting forward consistently to new
style. We just do the error prefixing in the caller.
Closes: #914
Approved by: alexlarsson
Colin Walters [Mon, 12 Jun 2017 14:05:02 +0000 (10:05 -0400)]
repo: Fix leak of superblock fds when generating summary
Related: https://github.com/ostreedev/ostree/issues/920
Closes: #921
Approved by: alexlarsson
Colin Walters [Fri, 9 Jun 2017 14:57:40 +0000 (10:57 -0400)]
ci: Add CentOS 7 build
For similar reasons as https://github.com/projectatomic/rpm-ostree/pull/824
Closes: #919
Approved by: jlebon
Colin Walters [Thu, 8 Jun 2017 17:47:20 +0000 (13:47 -0400)]
ci: Update to match current rpm-ostree
This copies the `ci/` directory from rpm-ostree, with much the same rationale;
among other things we don't want to depend on the Docker hub.
The specific reason I'm doing this is that I want to add a CentOS7 build, but
that means we can't use `projectatomic/ostree-tester`, and at that point we
might as well unwind it all.
Closes: #917
Approved by: jlebon
Alexander Larsson [Mon, 14 Dec 2015 09:58:53 +0000 (10:58 +0100)]
repo: After renaming in all loose objects, ensure metadata is stable
When a transaction is finished and we have moved all the staged loose
objects into the repo we fsync all the object directory, to ensure the
filenames are stable before we update the refs files to point to the
new commits.
With out this an unclean shutdown after the transaction is finished
could result in a refs file that points to an incomplete commit.
https://bugzilla.gnome.org/show_bug.cgi?id=759442
Closes: #918
Approved by: cgwalters
Colin Walters [Wed, 7 Jun 2017 17:18:04 +0000 (13:18 -0400)]
repo/commit: Support group-writable files for bare-user-only
These exist in the wild for flatpak, and aren't really a problem. The canonical
permissions are still either `0755` or `0644`, we just support the additional
writable bit for the group (i.e. extend the set to include `0775` and `0664`)
now to avoid breaking some flatpak content.
Closes: #913
Approved by: alexlarsson
Colin Walters [Wed, 7 Jun 2017 17:12:08 +0000 (13:12 -0400)]
tests: Add a test for bare-user-only failing to commit suid content
We didn't have coverage of this before, and adding the test infrastructure will
help ensure we have coverage for more changes here.
Closes: #913
Approved by: alexlarsson
Colin Walters [Mon, 5 Jun 2017 15:32:52 +0000 (11:32 -0400)]
lib/repo: For bare-user, mask content object modes with 0775
Having every object in a bare-user repo (and checkouts) be executable
is ugly. I can't think of a good reason to do that; they should only
be executable if their input is. This does
for `bare-user` what we did for `bare-user-only` in
https://github.com/ostreedev/ostree/pull/909
It's also a stronger version of what we do with `checkout -U` in suppressing
suid - here we also strip world-writable files and the sticky bit (even though
that's meaningless today, it might not be in the future).
Closes: https://github.com/ostreedev/ostree/issues/907
Closes: #908
Approved by: alexlarsson
Colin Walters [Wed, 7 Jun 2017 19:25:21 +0000 (15:25 -0400)]
lib/repofile: Follow symlinks for `g_file_read()`
This avoids `ostree cat /path/to/symlink` crashing, a longstanding embarassing
issue.
Closes: #915
Approved by: jlebon
Colin Walters [Wed, 7 Jun 2017 18:53:06 +0000 (14:53 -0400)]
lib/repofile: Port mostly to new code style
Prep for a bugfix.
Closes: #915
Approved by: jlebon
Colin Walters [Wed, 7 Jun 2017 18:45:42 +0000 (14:45 -0400)]
builtins/cat: Port to new code style
Definitely better. Prep for another fix.
Closes: #915
Approved by: jlebon
Philip Withnall [Wed, 7 Jun 2017 14:41:17 +0000 (15:41 +0100)]
lib/fetcher: Add cleanup function for OstreeFetcher
This is only used internally (the header is not public), so it doesn’t
have to go in ostree-autocleanups.h. It will be used in some following
commits.
Signed-off-by: Philip Withnall <withnall@endlessm.com>
Closes: #911
Approved by: cgwalters
Philip Withnall [Wed, 7 Jun 2017 13:32:29 +0000 (14:32 +0100)]
lib/repo: Omit deltas from the summary file if there are none
If there are no deltas to be listed in the summary file, don’t bother
including the key for them in the additional metadata section of the
file. This saves a few bytes in some cases.
Signed-off-by: Philip Withnall <withnall@endlessm.com>
Closes: #911
Approved by: cgwalters
Philip Withnall [Wed, 7 Jun 2017 11:03:57 +0000 (12:03 +0100)]
ostree/dump: Improve formatting for well-known commit metadata keys
This follows on from commit
a946c3d4, which added formatting for
well-known summary metadata keys. This commit adds it for commits.
Currently, the only well-known commit metadata key is
ostree.commit.timestamp. Formatting this correctly is especially
important, since it’s a big-endian uint64, which is completely unusable
for mere mortals when presented as a number rather than a date.
Non-formatted output can still be retrieved using the OSTREE_DUMP_RAW
flag, and the non-formatted key name is always printed for clarity.
Signed-off-by: Philip Withnall <withnall@endlessm.com>
Closes: #911
Approved by: cgwalters
Philip Withnall [Wed, 7 Jun 2017 13:31:19 +0000 (14:31 +0100)]
lib/pull: Fix an over-indented block
Signed-off-by: Philip Withnall <withnall@endlessm.com>
Closes: #911
Approved by: cgwalters
Philip Withnall [Wed, 7 Jun 2017 13:28:23 +0000 (14:28 +0100)]
lib/pull: Drop some trailing whitespace
Signed-off-by: Philip Withnall <withnall@endlessm.com>
Closes: #911
Approved by: cgwalters
Philip Withnall [Wed, 7 Jun 2017 13:46:15 +0000 (14:46 +0100)]
lib/pull: Simplify a for-loop initialisation
It’s a bit neater to initialise the loop iterator and maximum in the
same place.
Signed-off-by: Philip Withnall <withnall@endlessm.com>
Closes: #911
Approved by: cgwalters
Philip Withnall [Wed, 7 Jun 2017 13:46:02 +0000 (14:46 +0100)]
lib/pull: Fix a typo in a documentation comment
Signed-off-by: Philip Withnall <withnall@endlessm.com>
Closes: #911
Approved by: cgwalters
Philip Withnall [Wed, 31 May 2017 13:46:40 +0000 (14:46 +0100)]
lib/repo: Reindent some code in regenerate_summary() for clarity
This makes it a bit more easily separable from the rest of the code in
the function. No functional changes.
Signed-off-by: Philip Withnall <withnall@endlessm.com>
Closes: #911
Approved by: cgwalters
Colin Walters [Tue, 6 Jun 2017 17:34:27 +0000 (13:34 -0400)]
Canonicalize bare-user-only perms with 0755 mask
For the flatpak use case where bare-user-only was introduced, we actually
don't want to support s{u,g} id files in particular.
Actually, I can't think of a reason to have anything outside of the
`0755 i.e. (u=rwx,g=rx,o=rx)` mask, so that's what we do here.
This will have the effect of treating existing `bare-user-only` repositories as
corrupted if they have files outside of that mask, but I think we should do this
now; most of the flatpak users will still be on `bare-user`, and we haven't
changed the semantics of that mode yet.
Note that in this patch we will also *reject* file content that doesn't
match this. This is somewhat asymmetric, since we aren't similarly rejecting
e.g. directory metadata. But, this will close off the biggest source
of the problem for flatpak (setuid binaries).
See: https://github.com/ostreedev/ostree/pull/908
See: https://github.com/flatpak/flatpak/pull/837
Closes: #909
Approved by: alexlarsson
Owen W. Taylor [Wed, 7 Jun 2017 02:51:00 +0000 (22:51 -0400)]
lib/repo: Don't copy xattrs when manipulating the GPG keyring
Copying xattrs when manipulating the GPG keyring for a repository
causes errors when the underlying filesystem doesn't support writing
xattrs - overlayfs is a common example. It also causes the selinux
attributes of the keyring files to be copied from the temporary
location instead of properly inherited from the destination directory
(ending up, for example, as unconfined_u:object_r:user_tmp_t:s0, rather
than unconfined_u:object_r:data_home_t:s0)
Closes: #910
Approved by: cgwalters
Colin Walters [Fri, 2 Jun 2017 19:26:26 +0000 (15:26 -0400)]
Don't install trivial-httpd man page if not enabled
I just noticed this scroll by in a file listing.
Closes: #905
Approved by: jlebon
Jonathan Lebon [Fri, 2 Jun 2017 17:41:33 +0000 (13:41 -0400)]
basic-test.sh: explicitly check for uncompressed objects
It's not enough to check that the dir exists, since that's done by
default when we open the repo. We want to actually check that
uncompressed objects were cached (i.e. the opposite of the earlier error
path).
Closes: #903
Approved by: cgwalters
Jonathan Lebon [Fri, 2 Jun 2017 17:18:49 +0000 (13:18 -0400)]
manual: document bare-user-only repo mode
Closes: #903
Approved by: cgwalters
Jonathan Lebon [Fri, 2 Jun 2017 14:09:23 +0000 (10:09 -0400)]
checkout: also chmod in the user checkout case
When falling back to copying, we previously would only chmod checked out
files in the non-user-checkout mode. Fix this by always doing chmod.
The file_mode was being prepared but never actually applied.
Add a basic test in the archive-z2 --> usermode checkout case in which
we're guaranteed to always fall back to copy mode.
Closes: #633
Closes: #903
Approved by: cgwalters
Jonathan Lebon [Fri, 2 Jun 2017 14:06:50 +0000 (10:06 -0400)]
checkout: don't apply SELinux labeling in user mode
If the user requested a user checkout, we don't want to set the SELinux
label xattr.
Closes: #903
Approved by: cgwalters
Brian C. Lane [Fri, 2 Jun 2017 15:30:43 +0000 (08:30 -0700)]
Remove the OSTREE_MAX_RECURSION limit on metadata depth
This was making it impossible to pull or mirror a large ostree repo, and
according to Colin is no longer necessary. It works fine with a test
against a repo with 2741 commit and 451468 objects in it.
Closes: #899
Closes: #904
Approved by: jlebon
Colin Walters [Fri, 2 Jun 2017 13:27:52 +0000 (09:27 -0400)]
Revert "Add a notion of "physical" sysroot, use for remote writing"
This reverts commit
1eff3e83436b6129c0dc350dbbda52ba330e3834. There
are a few issues with it. It's not a critical thing for now, so
let's ugly up the git history and revisit when we have time to
debug it and add more tests.
Besides the below issue, I noticed that the simple `ostree remote add`
now writes to `/ostree/repo/config` because we *aren't* using the
`--sysroot` argument.
Closes: https://github.com/ostreedev/ostree/issues/901
Closes: #902
Approved by: mike-nguyen
Krzesimir Nowak [Fri, 2 Jun 2017 12:50:29 +0000 (14:50 +0200)]
lib/sysroot: Document the NO_CLEAN flag
Closes: #900
Approved by: jlebon
Colin Walters [Thu, 1 Jun 2017 19:55:15 +0000 (15:55 -0400)]
lib/repo: Delete unused private prototypes
The implementations were removed in:
6ffcb24d227eae5a479caf45adb8037eceb6ae33
I noticed this while looking at the commit code.
Closes: #898
Approved by: jlebon
Colin Walters [Tue, 23 May 2017 20:18:31 +0000 (16:18 -0400)]
repo/commit: Split up metadata/content commit paths
There was a lot of conditionals inside `write_object()` differentating
between metadata/content, and then for content, on the different repo
types. Further, in the metadata path since the logic is simpler, can
present a non-streaming API, and further use `OtTmpfile`, etc.
Splitting them up helps drop a lot of conditionals. We introduce a small
`CleanupUnlinkat` that allows us to fully convert to the new code style in both
functions.
This itself is still prep for fully switching to `GLnxTmpfile`.
Closes: #881
Approved by: jlebon
Colin Walters [Tue, 23 May 2017 19:13:08 +0000 (15:13 -0400)]
repo/commit: Don't renormalize trusted metadata
As the comment in the code says; in the expected checksum case, the caller
really has to have a normal form already.
Closes: #881
Approved by: jlebon
Colin Walters [Tue, 23 May 2017 19:04:50 +0000 (15:04 -0400)]
repo/commit: In the expected checksum case, check existence early
If we have an expected checksum, call `fstatat(repo_dfd, checksum)`
early on before we do much else. This actually duplicates code,
but future work here is going to split up the metadata/content
commit paths, so they'll need to diverge anyways.
Closes: #881
Approved by: jlebon
Colin Walters [Tue, 23 May 2017 18:58:03 +0000 (14:58 -0400)]
repo/commit: Dedup content writing API implementation
Similar to metadata, for `write_content_trusted()` we can just
call `_write_content()` with a `NULL` output checksum.
Closes: #881
Approved by: jlebon
Colin Walters [Tue, 23 May 2017 18:49:17 +0000 (14:49 -0400)]
repo/commit: Dedup metadata writing API implementations
First, the streaming metadata API is pretty dumb, since metadata
should be small. Really we should have supported a `GBytes`
version. Currently, this API *is* used when we do local pulls,
so this commit has test coverage. However, I plan to change
the object import to avoid using this. But that's fine, since
I can't think of why someone would use this API.
Next, the only difference between `ostree_repo_write_metadata()` and
`ostree_repo_write_metadata_trusted()` is whether or not we pass
an output checksum; so just dedup the implementations.
Also while I'm here break out the input length validation and do
it early in the streaming case.
Closes: #881
Approved by: jlebon
Colin Walters [Tue, 30 May 2017 18:07:13 +0000 (14:07 -0400)]
Add a notion of "physical" sysroot, use for remote writing
Using `${sysroot}` to mean the physical storage root: We don't want to write to
`${sysroot}/etc/ostree/remotes.d`, since nothing will read it, and really
`${sysroot}` should just have `/ostree` (ideally). Today the Anaconda rpmostree
code ends up writing there. Fix this by adding a notion of "physical" sysroot.
We determine whether the path is physical by checking for `/sysroot`, which
exists in deployment roots (and there shouldn't be a `${sysroot}/sysroot`).
In order to unit test this, I added a `--sysroot` argument to `remote add`.
However, doing this better would require reworking the command line parsing for
the `remote` argument to support specifying `--repo` or `--sysroot`, and I
didn't quite want to do that yet in this patch.
Closes: https://github.com/ostreedev/ostree/issues/892
Closes: #896
Approved by: jlebon
Colin Walters [Tue, 30 May 2017 17:04:18 +0000 (13:04 -0400)]
lib/util: Some style conversion
I saw a few instances of `glnx_set_error_from_errno() + return FALSE`,
and fixed them and did a bit of style conversion.
Closes: #895
Approved by: jlebon
Colin Walters [Fri, 26 May 2017 21:53:49 +0000 (17:53 -0400)]
cmd: Use autoptr for GKeyFile
Prep for code style conversion.
Closes: #891
Approved by: jlebon
Colin Walters [Fri, 26 May 2017 18:35:34 +0000 (14:35 -0400)]
tree-wide: Add+run spatch to use glnx_throw()
I had to run a sed job to add whitespace after, but otherwise this was easy.
Closes: #890
Approved by: jlebon
Colin Walters [Thu, 25 May 2017 23:38:52 +0000 (19:38 -0400)]
lib/sysroot: Add non-failable ostree_sysroot_repo()
Having a failable accessor is annoying, since it's really common
to reference both. Instead, open the repo once when we load
the sysroot, and provide a non-failable accessor.
This is also prep for `ostree_repo_open_at()`, which collapses the separation
between `ostree_repo_new()` and `ostree_repo_open()`.
Closes: #886
Approved by: jlebon
Colin Walters [Thu, 25 May 2017 21:26:42 +0000 (17:26 -0400)]
lib: Add an "is_system" member to OstreeRepo
This is prep for introducing a fd-relative `ostree_repo_new_at()`.
Previously, `ostree_repo_is_system()` compared `GFile` paths, but
there's a much simpler check we can do first - if this repository
was created via `OstreeSysroot`, it must be a system repo.
Closes: #886
Approved by: jlebon
Colin Walters [Fri, 26 May 2017 17:41:12 +0000 (13:41 -0400)]
lib/fsutil: Port to new code style
Pretty trivial.
Closes: #889
Approved by: jlebon
Colin Walters [Fri, 26 May 2017 17:40:14 +0000 (13:40 -0400)]
lib/fsutil: Delete unused GFile ioctl method
All the deployment code uses fds.
Closes: #889
Approved by: jlebon
Colin Walters [Fri, 26 May 2017 14:22:52 +0000 (10:22 -0400)]
pull-test: Add some 404 tests
See: https://github.com/flatpak/flatpak/issues/816
Closes: #887
Approved by: jlebon
Jonathan Lebon [Thu, 25 May 2017 16:28:15 +0000 (12:28 -0400)]
PAPR: migrate to the new name
The redhat-ci service has been renamed to PAPR. Previous values are
still supported though should be considered deprecated.
Closes: #885
Approved by: cgwalters
Colin Walters [Wed, 24 May 2017 20:43:39 +0000 (16:43 -0400)]
tests: Add some C tests for object writing
Prep for https://github.com/ostreedev/ostree/pull/881
Closes: #884
Approved by: jlebon
Colin Walters [Fri, 17 Mar 2017 21:18:27 +0000 (17:18 -0400)]
lib/deploy: Port config merge logic to new code style
This is a de-scoping of work I did in preparation for
rpm-ostree [live updates](https://github.com/projectatomic/rpm-ostree/pull/652).
Originally I was going to expose this as a public API.
However, I decided to do things differently, but the cleanup here for new code
style and fd-relative is nice to have anyways.
We rework things to use `OstreeDeployment*`, which the caller is expected to
already have, rather than `GFile*`s pointing to the config directories.
Closes: #741
Approved by: jlebon
Alexander Larsson [Wed, 24 May 2017 09:12:05 +0000 (11:12 +0200)]
fetcher: Send Accept-Encoding: gzip when downloading summary
The summary file can get large, but it compresses well (something
which is not true of other files in the ostree repo which are
already compressed). By sending Accept-Encoding: gzip (and
handling the compressed results) we send a lot less data.
I set up the flathub repo (http://flathub.org/repo) to enable
gzip for the summary file (only), and the result is that the
331514 byte large summary was transferred in 122889 bytes.
On my (fast) network this decreased the time i took to do
"flatpak remote-ls flathub" by about 100msec.
This fixes https://github.com/ostreedev/ostree/issues/802
Closes: #882
Approved by: cgwalters
Philip Withnall [Tue, 23 May 2017 12:26:25 +0000 (13:26 +0100)]
build: Use AM_TESTS_ENVIRONMENT rather than TESTS_ENVIRONMENT
TESTS_ENVIRONMENT is reserved for the user to be able to set when
running the tests. AM_TESTS_ENVIRONMENT is for the tests’ Makefile to
set itself.
https://www.gnu.org/software/automake/manual/html_node/Scripts_002dbased-Testsuites.html
Signed-off-by: Philip Withnall <withnall@endlessm.com>
Closes: #880
Approved by: cgwalters
Colin Walters [Wed, 17 May 2017 15:02:56 +0000 (11:02 -0400)]
Add stub for new libglnx tmpfile API, port simpler callers to it
It's hard right now to do a full port to the new libglnx tmpfile
API since there are complex cases in the commit path which deal
with symlinks as well.
Let's make things more gradual by introducing the important part (struct with
autocleanup) here in libotutil, port what we can. This will make a future
complete port easier.
Closes: #871
Approved by: jlebon
Colin Walters [Mon, 15 May 2017 21:24:52 +0000 (17:24 -0400)]
bin/cookies: Delete dead tmpfile code in cookie list command
This was a copy-paste-o.
Closes: #871
Approved by: jlebon
Daniel Drake [Mon, 15 May 2017 18:13:38 +0000 (12:13 -0600)]
Allow commits to mark refs as EOL, replaced by others
A commit can now include a "ostree.endoflife-rebase" metadata key
pointing to a new ref.
When updating, the sysroot upgrader will see this and proceed to
pull and deploy the new ref instead. The origin file in the new
deployment will point to the new ref.
This functionality is planned to be used in Endless OS. We will create
a lesser tested branch for brand new, cutting edge hardware support,
and ship that on hardware platforms that require the latest drivers.
However, once our slower-moving official release is later updated to
support the new hardware, we will use this functionality to migrate
those bleeding-edge users over to the official release.
Closes: #874
Approved by: cgwalters
Daniel Drake [Wed, 3 May 2017 15:36:48 +0000 (09:36 -0600)]
libtest: allow committing to alternative branches
This will be used by the upcoming test-admin-upgrade-endoflife.sh
Closes: #874
Approved by: cgwalters
Colin Walters [Fri, 19 May 2017 17:10:45 +0000 (13:10 -0400)]
tests/libtest-core: Copy rpm-ostree changes, clean up
I want to keep this a "pure copy-able" file into various projects
like rpm-ostree, bwrap, and flatpak. Pull in changes from rpm-ostree
to prep for that.
While we have the patient open, dedup the code for file matching a bit.
Closes: #877
Approved by: jlebon
Colin Walters [Fri, 19 May 2017 14:39:48 +0000 (10:39 -0400)]
ci: Add unit case for --enable-experimental-api
We're starting to get a lot of contexts, and this is likely going to drive some
requirements for consolidation and improvements like not testing *every* context
on every PR, etc.
But for now since experimental is new, and under development, let's test it.
Closes: #875
Approved by: cgwalters
Colin Walters [Fri, 19 May 2017 15:00:34 +0000 (11:00 -0400)]
tests/test-symbols.sh: Fix with --enable-experimental-api
We missed a `--no-filename` for grep with the documentation.
Closes: #875
Approved by: cgwalters
Philip Withnall [Fri, 19 May 2017 09:11:35 +0000 (10:11 +0100)]
lib/remote: Fix compilation with --enable-experimental-api
The whole ostree-remote.h file is only included in the public ostree.h
header if OSTREE_ENABLE_EXPERIMENTAL_API is defined, so there’s no need
to change the set of methods defined in it according to whether we’re
compiling with experimental API.
Signed-off-by: Philip Withnall <withnall@endlessm.com>
Closes: #875
Approved by: cgwalters
Philip Withnall [Thu, 18 May 2017 07:28:03 +0000 (08:28 +0100)]
lib/repo: Make ost_repo_remove_remote() available internally
Make it an internal, not static, API; like _ostree_repo_add_remote(). It
will be used in many the same situations.
Signed-off-by: Philip Withnall <withnall@endlessm.com>
Closes: #875
Approved by: cgwalters
Philip Withnall [Thu, 18 May 2017 07:26:34 +0000 (08:26 +0100)]
lib/repo: Add return value to _ostree_repo_add_remote()
Return whether the remote already existed. This is an internal API, so
it’s not an API break. The return value will be useful in upcoming
commits for working out whether to later remove a remote again.
Signed-off-by: Philip Withnall <withnall@endlessm.com>
Closes: #875
Approved by: cgwalters
Philip Withnall [Thu, 18 May 2017 07:17:29 +0000 (08:17 +0100)]
lib/remote: Add arguments to internal OstreeRemote constructor
Add a name argument to the internal OstreeRemote constructor,
since this member (and several derived from it) is non-nullable,
and hence must always be set at construction time.
This changes the only call sites of the constructor to use the new API,
which is internal.
Signed-off-by: Philip Withnall <withnall@endlessm.com>
Closes: #875
Approved by: cgwalters
Philip Withnall [Thu, 18 May 2017 07:16:18 +0000 (08:16 +0100)]
lib/remote: Add internal annotations to OstreeRemote
Just for internal documentation; g-ir-scanner doesn’t read or understand
them.
Signed-off-by: Philip Withnall <withnall@endlessm.com>
Closes: #875
Approved by: cgwalters
Philip Withnall [Thu, 18 May 2017 07:11:32 +0000 (08:11 +0100)]
lib/remote: Add a getter for OstreeRemote.name
Now that we’ve got a public, sealed OstreeRemote structure, we can start
carefully exposing members of it as API.
Signed-off-by: Philip Withnall <withnall@endlessm.com>
Closes: #875
Approved by: cgwalters
Jonathan Lebon [Wed, 17 May 2017 15:41:54 +0000 (11:41 -0400)]
pull: complete detached meta fetch before scanning
If somehow a repo has gpg verification on but doesn't have signatures
present for the existing commit, ostree would error out if it needs to
scan the commit object (e.g. if there are no updates available).
An instance of this is currently happening in Fedora AH, in which
signatures are not shipped in the ISO due to filesystem restrictions.
Another possible scenario is if a content provider switches from not
signing commits to signing them; even if older commits are retroactively
signed, clients' local commit objects would error out if they needed
scanning.
This patch adds a check to ensure that we always attempt to fetch the
detached metadata and wait for its result (whether it exists or not)
before moving on to scan their corresponding commit objects.
See also: https://github.com/projectatomic/rpm-ostree/issues/630
Closes: #873
Approved by: cgwalters
Colin Walters [Tue, 16 May 2017 16:02:25 +0000 (12:02 -0400)]
Release 2017.6
There's already a lot queued. In particular this brings some API
additions that rpm-ostree depends on.
Closes: #865
Approved by: jlebon
Colin Walters [Wed, 17 May 2017 13:55:34 +0000 (09:55 -0400)]
lib/pull: Port some functions to new code style
Porting a lot of this file would be hard since in many cases we do processing in
the `out:` section, so let's do what we can.
Closes: #870
Approved by: jlebon
Colin Walters [Wed, 17 May 2017 01:44:22 +0000 (21:44 -0400)]
switchroot/generator: Add var.mount to local-fs.target.requires
Unbreaks mounting in CentOS. Newer systemd in Fedora pulls didn't need this, I
think due to `RequiresMountsFor=`. Anyways, this is what the fstab generator
does, and it's clearly right ✓.
Closes: https://github.com/ostreedev/ostree/issues/867
Closes: #869
Approved by: jlebon
Colin Walters [Wed, 17 May 2017 01:46:22 +0000 (21:46 -0400)]
build: Use cd $(srcdir) instead of `git -C`
Since the version in CentOS is too old, and we get a spam of warnings, plus
things like detecting the git repo break.
Fixes: 50f73cbac35be97fd5895531e295d05dabaa8ed9
Closes: #868
Approved by: jlebon
Colin Walters [Tue, 16 May 2017 15:30:35 +0000 (11:30 -0400)]
lib/upgrader: Port to new code style
No surprises here. Prep for future work.
Closes: #864
Approved by: jlebon